package com.shujia.day12;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;

public class Demo03IOWriteImage {
    public static void main(String[] args) throws IOException {
        String path = "data/th.jpg";
        String outPath = "data/out.jpg";
        int capacityLen = 100;
        byte[] bytes = new byte[capacityLen];  // 可以看成是一个瓢
        FileInputStream fileInputStream = new FileInputStream(path);
        FileOutputStream fileOutputStream = new FileOutputStream(outPath);

        int readLength = 0;
        while ((readLength = fileInputStream.read(bytes)) > 0) {
            fileOutputStream.write(bytes,0,readLength);
        }
        // 关闭流
        fileInputStream.close();
        fileOutputStream.close();

    }
}
